// import { ref, Ref, onUnmounted, onMounted } from 'vue';
// const audioLoading = ref(false);
// let audioTimer = ref(null);
// onUnmounted(() => {
//     clearTimeout(audioTimer.value);
// })
import { ref, onUnmounted } from 'vue';

export function useCounter() {
    const audioLoading = ref(false);
    const audioTimer = ref(null);

    // 模拟定时器
    const clearaudioTimer=()=>{
        audioLoading.value = false;
        clearInterval(audioTimer.value);
    }

    // 页面销毁时清除定时器
    onUnmounted(() => {

        clearInterval(audioTimer.value);
    });

    return {
        audioTimer, audioLoading,clearaudioTimer
    };
}